package cn.caojun;

import cn.caojun.auth.interceptor.AuthInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.omg.PortableInterceptor.Interceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@SpringBootApplication
@MapperScan("cn.caojun.*.mapper")
@ServletComponentScan("cn.caojun.auth.annotation.listener")//启动监听器
public class ApplicationStarter implements WebMvcConfigurer {
    public static void main(String[] args){
        SpringApplication.run(ApplicationStarter.class,args);
    }

    @Autowired
    private AuthInterceptor authInterceptor;//将utils的监听器注入

//    @Override
//    public void addInterceptors(InterceptorRegistry registry){
//        registry.addInterceptor(authInterceptor)
//                .addPathPatterns("/**")
//                .excludePathPatterns("/login","/logout");
//    }
}
